<template>
  <div class="leftbox">
    <div class="logocon"><span>welcome</span> to ximo</div>
    <div class="itemboix">
      <div class="item" v-for="i in item" :key="i.title">
        <div class="title">{{ i.title }}</div>
        <div
          class="con"
          :class="{ ac: route.fullPath == j.path }"
          v-for="j in i.con"
          :key="j.icon"
          @click="changencurrent(j.path)"
        >
          <div class="iconfont" :class="j.icon"></div>
          {{ j.con }}
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const router = useRouter();
const item = [
  {
    title: "Data display",
    con: [
      {
        icon: "icon-biaoshitu",
        path: "/index",
        con: "Data view",
      },
    ],
  },
  {
    title: "Display settings",
    con: [
      {
        icon: "icon-carousel_horizontal",
        path: "/index/userbander",
        con: "User-bander",
      },
    ],
  },
  {
    title: "Account Mgmt",
    con: [
      {
        icon: "icon-nvshangjia",
        path: "/index/zhsj",
        con: "Merchant Mgmt",
      },
      {
        icon: "icon-yonghu",
        path: "/index/zhyh",
        con: "User Mgmt",
      },
    ],
  },
  {
    title: "Store Mgmt",
    con: [
      {
        icon: "icon-biaoshitu",
        path: "/index/ctrl",
        con: "monitor",
      },
    ],
  },
  {
    title: "Order Mgmt",
    con: [
      {
        icon: "icon-dingdan",
        path: "/index/ddyh",
        con: "User Orders",
      },
    ],
  },
  {
    title: "Dish Mgmt",
    con: [
      {
        icon: "icon-food-list",
        path: "/index/cp",
        con: "All dishes",
      },
    ],
  },
];
const changencurrent = (e: string): void => {
  router.push(e);
};
</script>

<style scoped lang="scss">
.leftbox {
  height: 100%;
  width: 100%;
  overflow: auto;
  background-color: #111315;
  border-right: 1px solid #4c4d4f;
  padding: 1vw;
  display: flex;
  flex-direction: column;
  align-items: center;

  &::-webkit-scrollbar {
    display: none;
  }
  .ac {
    background-color: var(--them-color);
    color: #000 !important;
    font-weight: 700;
    transition: all 0.4s;
  }
  .item {
    color: #4b4d4f;
    margin-top: 1.5vw;
    width: 100%;
    padding-left: 17px;
    .title {
      width: 100%;
      text-align: start;
      height: 1.7vw;
      font-size: 0.75vw;
      white-space: nowrap;
      color: #fff;
      font-weight: 700;
    }

    .con {
      font-size: 0.65vw;
      padding-left: 25px;
      height: 2.5vw;
      border-radius: 10px;
      display: flex;
      align-items: center;
      gap: 5px;
      margin-top: 10px;
      transition: all 0.4s;
      color: #fff;

      cursor: pointer;
      &:hover {
        transition: all 0.2s;
        background-color: var(--them-color2);
        color: #000 !important;
        font-weight: 700;
        .iconfont {
          color: #000;
          font-size: 0.8vw;
        }
      }
      .iconfont {
        color: #fff;
        font-size: 0.7vw;
      }
    }
  }
  .itemboix {
    width: 100%;
    height: calc(100% - 30px);
    overflow: auto;
    &::-webkit-scrollbar {
      display: none;
    }
  }
  .logocon {
    height: 2vw;
    width: 100%;
    color: #fff;
    align-self: flex-end;
    font-size: 1vw;
    font-weight: 700;
    white-space: nowrap;
    padding-bottom: 0.2vw;
    font-family: "Luckiest Guy";
    text-shadow: 0 0 20px var(--them-color);
    span {
      font-size: 1.5vw;
    }
  }
}
</style>
